//
//  FR_AbsentClass_TableViewCell.m
//  FaceRecognition
//
//  Created by zz on 17/7/18.
//  Copyright © 2017年 Sylar. All rights reserved.
//

#import "FR_AbsentClass_TableViewCell.h"

@interface FR_AbsentClass_TableViewCell()

@property (nonatomic, strong) UILabel *classLabel;
@property (nonatomic, strong) UILabel *nameLabel; //姓名
@property (nonatomic, strong) UILabel *absentDateLabel; //旷课日期

@end

@implementation FR_AbsentClass_TableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        
        CGFloat w = SCREENWIDTH / 3;
        
        for (int i = 0; i < 3; i ++) {
            
            CGFloat x = w * i;
            
            UILabel *label = [[UILabel alloc] init];
            label.textAlignment = NSTextAlignmentCenter;
            label.font = [UIFont systemFontOfSize:15];
            label.textColor = [UIColor colorWithHexString:@"#3b3b3b"];
            [self.contentView addSubview:label];
            
            if ( i == 0) {
                _classLabel = label;
                
            }else if (i == 1){
                _nameLabel = label;
            }else {
                _absentDateLabel = label;
            }
            
        }
        
        CGFloat rate = SCREENWIDTH / 375;
        _classLabel.frame = CGRectMake(15 * rate, 0, 105  * rate, 44);
        _nameLabel.frame = CGRectMake(CGRectGetMaxX(_classLabel.frame), 0, 90 * rate, 44);
        _absentDateLabel.frame = CGRectMake(CGRectGetMaxX(_nameLabel.frame), 0, 150 * rate, 44);
        
        UIView *lineView = [[UIView alloc] initWithFrame:CGRectMake(15, 43.5, SCREENWIDTH - 15, 0.5)];
        lineView.backgroundColor = [UIColor colorWithHexString:@"#dedede"];
        [self.contentView addSubview:lineView];
    }
    
    return self;
}

- (void)setModel:(FR_Attendance_Model *)model {
    
    _model = model;
    
    _classLabel.text = model.classname;
    _nameLabel.text = model.studentname;
    _absentDateLabel.text = model.date;
}

@end
